import en_us from "./en-us.json"
import de_de from "./de-de.json"
import pl_pl from "./pl-pl.json"
import tr_tr from "./tr-tr.json"
import fr_fr from "./fr-fr.json"
import es_es from "./es-es.json"
import zh_cn from "./zh-cn.json"
import zh_tw from "./zh-tw.json"
import zh_hk from "./zh-hk.json"
import in_id from "./in-id.json"
import pt_pt from "./pt-pt.json"
export const message = {
  'en-us': en_us,
  'de-de': de_de,
  'pl-pl': pl_pl,
  'tr-tr': tr_tr,
  'es-es': es_es,
  'fr-fr': fr_fr,
  'pt-pt': pt_pt,
  'zh-cn': zh_cn,
  'zh-tw': zh_tw,
  'zh-hk': zh_hk,
  'in-id': in_id,
}
export const t = (str) => {
  let s = ''
  if (!window._language) {
    s = str
    console.warn('window._language is undefined 系统语言未设置')
  }else if(!message[window._language]){
    s = str
    console.warn(`登录组件不存在该语言包： [${window._language}]`)
  }else if(!message[window._language][str]){
    console.warn(`'${str}' 在 [${window._language}] 语言包中不存在`)
    s = str
  } else {
    s = message[window._language][str]
  }
  return s
}
